
Page({
  data: {
    tabs: [
      {
        id: 0,
        value: '体验问题',
        isActive: true
      },
      {
        id: 1,
        value: '商品、商家投诉',
        isActive: false
      }
    ],
    chooseImage: [],
    textVla: ''
  },

  handleTabItem(e) {
    let index = e.detail
    let {tabs} = this.data

    tabs.forEach((item,i) => i === index ? item.isActive = true : item.isActive = false)
    this.setData({
      tabs
    })
  },

  // 点击添加图片
  handleChooseImg(e) {
    wx.chooseImage({
      success: (res) => {
        this.setData({
          chooseImage: [...this.data.chooseImage,...res.tempFilePaths]
        })
      }
    })
  },

  // 删除图片
  handleRemoveImg(e) {
    let index = e.currentTarget.dataset.index
    let {chooseImage} = this.data
    chooseImage.splice(index,1)
    this.setData({
      chooseImage
    })
  },

  // 获取文本域输入的内容
  handleTextInput(e) {
    this.setData({
      textVla: e.detail.value
    })
  },

  // 提交数据
  handleFormSubmit() {
    wx.showToast({
      title: '该功能正在开发中',
      icon: 'none'
    })
  }

})